/**
 * 给定五子棋的走法，判哪方在哪步获胜
 */
#include <bits/stdc++.h>
using namespace std;

#include <bits/extc++.h>
using namespace __gnu_pbds;


using llt = long long;
using Real = double;
using vi = vector<int>;
using pii = pair<int, int>;

int N, M;
vector<vi> Board;
vector<pii> A;

int const XIAN = 2;
int const HOU = 3;

const array<string, 4> Ans = {
    "", "", "HtBest", "WHZ"
};

const int DR[] = {-1, -1, 0, 1, 1, 1, 0, -1};
const int DC[] = {0, 1, 1, 1, 0, -1, -1, -1};

array<vector<vector<array<int, 8>>>, 4> Record;

void disp(){
    for(int i=1;i<=N;++i){
        for(int j=1;j<=N;++j)cout<<Board[i][j];
        cout << "\n";
    }
}

bool go(const pii & p, int c){
    assert(0 == Board[p.first][p.second]);
    Board[p.first][p.second] = c;

    auto & rec = Record[c];
    auto & d = rec[p.first][p.second];
    // fill(d.begin(), d.end(), 1);

    for(int nx,ny,i=0;i<8;++i){
        nx = p.first, ny = p.second;
        while(1){
            if(1 <= nx and nx <= N and 1 <= ny and ny <= N and Board[nx][ny] == c){
                nx += DR[i];
                ny += DC[i];
            }else{
                break;
            }
        }
        nx -= DR[i]; ny -= DC[i];
        int o = (i + 4) % 8;
        for(int k=1;1<=nx and nx <= N and 1 <= ny and ny <= N and Board[nx][ny] == c;++k){
            rec[nx][ny][o] = k;
            nx -= DR[i];
            ny -= DC[i];
            if(k >= 5) return true;
        }

    }

    return false;
}

void proc(){
    Record[XIAN].assign(N + 1, vector<array<int, 8>>(N + 1, {0, 0, 0, 0 ,0, 0, 0, 0}));
    Record[HOU].assign(N + 1, vector<array<int, 8>>(N + 1, {0, 0, 0, 0 ,0, 0, 0, 0}));

    int ori = XIAN;
    int k = 1;
    for(const auto & p : A){        
        if(go(p, ori)){
            cout << Ans[ori] << " " << k << endl;
            return;
        }
        // cout << k << "\n"; disp();
        k += 1;
        ori ^= 1;
    }
    cout << "UNK " << M << endl;
    return;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(0);
    cin >> N >> M;
    Board.assign(N + 1, vi(N + 1, 0));
    A.assign(M, {});
    for(auto & p : A) cin >> p.first >> p.second;
    proc();
    return 0;
}